import Vue from 'vue';
import App from './App.vue';
import router from './router';
import store from './store';
import ElementUI from 'element-ui';
import * as api from './api';

// import 'quill/dist/quill.core.css'

// import 'element-ui/lib/theme-chalk/index.css';

router.beforeEach((to, from, next) => {
  if(to.path === "/en") {
    store.state.language = 'en-US';
    document.title = "Dr. Tie Qiu's Homepage";
    next()
  } else if(store.state.language === 'en-US' && !to.query.lang){
    next({
      path: to.path,
      query: {
        lang: 'en-US'
      },
    });
  } else {
    next();
  }
})

Vue.use(ElementUI);
Vue.config.productionTip = false;
Vue.prototype.$api = api; // 将api挂载到vue的原型中

new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount('#app');
